package com.qfedu.service.impl;

import com.qfedu.dao.UserDao;
import com.qfedu.dao.impl.UserDaoImpl;
import com.qfedu.pojo.User;
import com.qfedu.service.UserService;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();
    @Override
    public User login(User user) {
        return userDao.queryByPhoneAndPassword(user.getPhone(),user.getPassword());
    }

    @Override
    public boolean existsUser(User user) {
        User user1 = userDao.queryByPhoneAndPassword(user.getPhone(), user.getPassword());
        if (user1!=null){
            return true;
        }
        return false;
    }

    @Override
    public void registerUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public void newPassword(String phone, String password) {
        userDao.newPassword(phone, password);
    }

    @Override
    public int fullUser(String phone ,String name, String gender, String idcode, String location) {
        return userDao.fullUser(phone,name,gender,idcode,location);
    }
}
